<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>类数组对象</title>
  <script src="js/jquery-1.11.3.js"></script>
</head>

<body>
  <ul>
    <li>亮亮</li>
    <li>然然</li>
    <li id="dd">东东</li>
  </ul>

  <script>
    var arr = [1, 2, 3, 4, 5, 4, 3, 2, 1];
    console.log("数组:", arr);
    var index = arr.indexOf(3);
    console.log("数组indexOf: 找到第一个3的位置:", index);
    index = arr.indexOf(3, index + 1);
    console.log("数组indexOf: 找到第二个3的位置:", index);
    index = arr.indexOf(3, index + 1);
    console.log("数组indexOf: 找到第三个3的位置:", index);
    // arr.forEach(function (elem) {
    //    console.log(elem);

    // });

    var $lis = $("ul>li");
    console.log("类数组对象:", $lis);
    console.log("length:", $lis.length);
    console.log("eq(0):", $lis.eq(0));
    console.log("get():", $lis.get());
    console.log("get(0):", $lis.get(0));

    var li = $lis.get(0);
    console.log("index()", $lis.index(li));
    $lis.each(function (index) {
      if (index == 2) {
        console.log($(this));
        $(this).css("border", "1px solid red")
      }
    });



    //类数组对象不能使用 数组的函数
  </script>
</body>

</html>